You should read the simple examples before trying these more advanced ones.
HINT: use right Amiga C the drag then clip the examples out of these docs to avoid typos.
---
It is possible to tap into or duplicate the data passed in a pipe. '/t' will add a readonly third end to a pipe.
Make sure you have two different shells available.
In the first shell type 'type awnpipe:mypipe/t'
In the second shell type 'echo >awnpipe:mypipe hello'
In the second shell type 'type awnpipe:mypipe '
The word hello came back from both the second end of the pipe and the 'Tap' third end.
---
In the first shell type 'copy con:////pipe-test/close awnpipe:mypipe'
In the second shell type 'type awnpipe:mypipe '
Type a few lines of text into the test con:, nothing comes out in the second shell. Close the test con:, now the data comes out. This is because the type command wants to read large blocks of data.
'/i' will cause data to pass out of the pipe immediately (as soon as its available).
In the first shell type 'copy con:////pipe-test/close awnpipe:mypipe'
In the second shell type 'type awnpipe:mypipe/i '
Now the text comes out of the pipe each time you hit return in the test con:.
Close the test con: to end the example.
---
You can use AWNPipe to read the tooltypes of an icon. The second end of the pipe automatically reads the tooltypes of FILENAME when '/xiFILENAME' is used. NOTE that parameters that start with '/x' can not be mixed with other parameters!
In a shell type 'type awnpipe:mypipe/xiDevs:dosdrivers/awnpipe'
YES the pipe name contains two colons ':', don't let it bug you.
The tooltype information from Devs:dosdrivers/awnpipe prints out. Note you do not include '.info' in the file name.
The data is typed out in the following format..
icon_type x y stack
default tool
tool window
first tooltype
second tooltype
...
If you get some weird number (-2147483648) for the X and Y values it means you did not snapshot the icon yet.
---
You can also use AWNPipe to write the tooltypes of an icon.
Copy a file with its icon into ram:., preferably an icon that has some tooltypes set in it.
In a shell 'copy awnpipe:/xiRam:filename ram:icondump' , do not include '.info' in the filename.
Now examine and edit the file ram:icondump change the default tool and tooltypes.
In a shell 'copy ram:icondump awnpipe:/xsRam:filename '.
Use the WB menu info function to verify the new setting in the icon.
---
AWNPipe can be used to pattern match. '/xm' is used for pattern matching. Data is usually written into the pipe, and the results of the pattern matching read back from THE SAME END OF THE PIPE. The second end of the pipe is automatically connected to a task that is doing the pattern matching. '/xmrFILENAME' causes the data to be read from a file rather than the pipe, the match results are read from the pipe.
In a shell type 'type awnpipe:mypipe/xmrcon:////pipetest/close'
In the pipetest con: type '#?a' . This sets a pattern to match any text ending in 'a'. 'ok 1' should come back from the pipe. ('ok 0' would means you did not enter a pattern so an exact match will be tested for.)
In the pipetest con: enter some text. If the text ends with 'a' then the pipe responds with '1' meaning a match. If not the pipe responds with '0' meaning no match. Close the pipe test con: to end the example.